package com.forlove.app.qselect.login.entity;

import com.forlove.app.qselect.login.widget.pickerview.model.IPickerViewData;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yjl on 2017/10/27.
 */

public class GroupEntity implements IPickerViewData {
    public DataInfoEntity mGroup;
    public List<DataInfoEntity> childTag = new ArrayList<>();

    public DataInfoEntity getmGroup() {
        return mGroup;
    }

    public void setmGroup(DataInfoEntity mGroup) {
        this.mGroup = mGroup;
    }

    public List<DataInfoEntity> getChildTag() {
        return childTag;
    }

    public void setChildTag(List<DataInfoEntity> childTag) {
        this.childTag = childTag;
    }

    @Override
    public String getPickerViewText() {
        return mGroup.getName();
    }

    public DataInfoEntity getChildGroup(int groupId) {
        DataInfoEntity child = null;
        for (int i = 0; i < childTag.size(); i++) {
            DataInfoEntity dataInfoEntity = childTag.get(i);
            if (dataInfoEntity.id == groupId) {
                child = dataInfoEntity;
                child.select = i;
                break;
            }
        }
        return child;
    }
}
